package org.example.realtime.jtp.dws.log.function;


import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.types.Row;
import org.example.realtime.jtp.dws.log.utils.AnalyzerUtil;

@FunctionHint(output = @DataTypeHint("ROW<word STRING>"))
public class IkAnalyzerFunction extends TableFunction<Row> {
    public void eval(String content) throws Exception
    {
        for (String word : AnalyzerUtil.ikAnalyzer(content))
        {
            Row row = new Row(1);
            row.setField(0, word);
            collect(row);
        }
    }
}
